#pragma once

#include <glm/glm.hpp>

namespace Fysics
{
	class ViewCamera
	{
	private:
		glm::mat4 m_ProjectionMatrix;
		glm::mat4 m_ViewMatrix;

		glm::vec3 m_Position;
		glm::vec3 m_Direction;
		glm::vec3 m_Up;
		glm::vec3 Right;
		glm::vec3 WorldUp;

		float m_Pitch;
		float m_Yaw;
		float Fov;

	public:
		void UpdateCameraVectors();
		void ProcessMouseMovement(float deltaX, float deltaY);

		ViewCamera(float fov = 45, glm::vec3 position = glm::vec3(0, 0, 7));

		void SetPosition(const glm::vec3& position);
		void SetFov(float fov);
		void SetPitch(float pitch) { m_Pitch = pitch; }
		void SetYaw(float yaw) { m_Yaw = yaw; }

		const glm::vec3& GetPosition() const { return m_Position; }

		const glm::mat4& GetProjectionMatrix() const { return m_ProjectionMatrix; }
		const glm::mat4& GetViewMatrix() const { return m_ViewMatrix; }

		const float& GetFov() const { return Fov; }
		const glm::vec3& GetCameraDirection() const { return m_Direction; }
		const glm::vec3& GetCameraUp() const { return m_Up; }
		const glm::vec3& GetCameraRight() const { return Right; }

		void RecalculateViewMatrix();
		void RecalculateProjectionMatrix();

		void CalculateViewMatrix();
	};
}